/*
    www.cguage.com
    1.5 求前置和与后置和相同的个数
*/

#include <iostream>
#include <sstream>
#include <cassert>
#include <vector>
using namespace std;

#ifndef TEST
#define IN(iss) {                       \
        std::string str;                \
        std::getline(std::cin, str);    \
        iss.str(str);                   \
    }
#define OUT(s) std::cout << s
#endif

#define READ_N(iss, n) {    \
    iss >> n;               \
    iss.ignore(1, ',');     \
}

int main() {
    istringstream iss;
    IN(iss);
    assert(!iss.eof());

    std::vector<int> v;
    while (!iss.eof()) {
        int n = 0;
        READ_N(iss, n);
        v.push_back(n);
    }

    int i = 0; 
    int j = v.size() - 1;
    int cnti = v[i];
    int cntj = v[j];
    int times = 1;  // 至少有一次，就是所有相加的时候
    while (i < (int)v.size() - 1 && j > 0) {
        if (cnti > cntj) {
            cntj += v[--j];
        } else if (cnti < cntj) {
            cnti += v[++i];
        } 

        if (cnti == cntj) {
            cnti += v[++i];
            // cntj += v[--j];
            ++times;
        }
    }   


    // 结果
    ostringstream oss;
    oss << times;
    OUT(oss.str());
    return 0;
}

#ifdef TEST
struct TestCase CASES[] = {
    /*0*/{"3,6,2,1,4,5,2", "3"},
    /*1*/{"1", "1"},
    /*2*/{"1,1", "2"},
};
#endif